home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98c.txt / 000078_icon-group-sender _Fri Nov 13 16:45:14 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) with SMTP id QAA04587
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Fri, 13 Nov 1998 16:45:13 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA07478; Fri, 13 Nov 1998 16:45:13 -0700
  7. Date: Fri, 13 Nov 1998 13:26:24 -0700
  8. From: swampler@noao.edu (Steve Wampler)
  9. Subject: Re: Coding multi-part patterns, as in SNOBOL
  10. To: icon-group@optima.CS.Arizona.EDU
  11. Message-Id: <swampler-9810132026.AA006410162@orpheus.gemini.edu>
  12. In-Reply-To: <Pine.LNX.3.95.981113120727.7576B-100000@smarty.smart.net>
  13. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  14. Status: RO
  15.  
  16. Mark Laster wrote:
  17. > One of my programs in ICON processes e-mail messages.  It does 
  18. > more than the snippet shown here, but for purposes of 
  19. > discussion, it removes the "e-mail quotation" marks from lines of 
  20. > text.  As you know, those marks in aggregate may be either: 
  21. >   (1) one or more angle brackets, starting at the left margin, or
  22. >   (2) one or more spaces, starting at the left margin, FOLLOWED 
  23. >       IMMEDIATELY BY one or more angle brackets.
  24. > To remove these "e-mail quote" marks, I needed about 20 lines, 
  25. > as shown below.
  26. > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  27. > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  28. > To perform the same operation in SNOBOL requires two lines (if 
  29. > that many):
  30. > ...
  31. >         qupat = pos(0) (span(" ") | null) span(">") rem . rec
  32. > ...
  33. > strip   rec qupat :s(strip)
  34. > ...
  35. > end
  36.  
  37. I haven't had a chance to test this (busy, busy), but something like
  38. the following should work in Icon (note how it's capitalized):
  39.  
  40.     procedure strip(s)
  41.         while s ?:= (tab(many('> ')), tab(0))
  42.         return s
  43.     end
  44.  
  45. This is even shorter than the SNOBOL you gave, but you can do something
  46. similar in SNOBOL, also.
  47.  
  48. --
  49. Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
  50. The gods that smiled at your birth are now laughing openly. (Fortune Cookie)
  51.